module run_test
   use kind_parameter
   use my_array
   implicit none
   private
   public:: rtest,print_sep,te1,te2

   abstract interface
      function test_fn() result(ret)
         import ::i4
         integer(i4) ::ret
      end function
   end interface

contains
   function rtest(fun) result(ret)
      procedure(test_fn) :: fun
      integer(i4):: ret
      call print_sep()
      ret=fun()
   end function rtest


   subroutine print_sep()
      character(20) :: sep_
      sep_='===================='
      write(*,"(A20)") sep_
   end subroutine

   function te1() result(ret)
      real(dp),dimension(5):: r
      integer(i4)::ret

      call f(r)
      write(*,"(ES14.8)") r
      ret=0
   end function

   function te2() result(ret)
      integer(i4)::ret
      real(dp) :: r(10)
      call f(r(1:10:2))
      call f(r(2:10:2))
      write(*,"(ES14.8)") r
      ret=0
   end function

end module run_test
